from jinja2 import Template

dict_1 = {'_database': {
    'mysql001': {'db': 'novel-plus', 'host': 'shop-xo.hctestedu.com', 'password': 'Aa9999!', 'port': 3306,
                 'user': 'api_test'}}, 'et_search_key': 'com.zhao.myreader:id/et_search_key',
    'expected_result_text': ['九唳', '九阙朝凰之第一女帝', '九重华锦', '原神'],
    'iv_search': 'com.zhao.myreader:id/iv_search', 'tv_search_conform': 'com.zhao.myreader:id/tv_search_conform'}
step_value = {'EXPECTED': '九', 'OP_STR': 'in', 'VALUE': '{{expected_result_text}}',
              '关键字': 'assert_text_comparators'}
# 将step_value中的单引号替换成双引号
step_value = str(step_value)
# step_value = step_value.replace("'", '"')
step_value = rf"{step_value}"
print(step_value)
template = Template(step_value)
print(dict_1)
print(step_value)
dict_2 = eval(template.render(dict_1))
print(dict_2)
